<?php


function getSessionLang() {

    global $CONFIG;

    if (!empty($_GET["hl"])) {
       $_SESSION["lang"] = $_GET["hl"];
    }

    if (empty($_SESSION["lang"])) {
        $_SESSION["lang"] = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2);
    }

    // If it's not translated default lant
    if (!file_exists($CONFIG->datadir.'/lang/'.$_SESSION["lang"].'.php')) {
        $_SESSION["lang"] = 'es';
    }
}


function getSessionTab() {

    if (!empty($_GET["tab"])) {
        $_SESSION["tab"] = $_GET["tab"];
    }

    if (empty($_SESSION["tab"])) {
        $_SESSION["tab"] = 't';
    }
}
